Test the third Tuesday of a monthΒΆ
Test the third Tuesday of a month.
from datetime import datetime
def is_third_tuesday(S):
d = datetime.strptime(S, '%b %d, %Y') # datetime.datetime(2015, 6, 23, 0, 0)
return d.weekday() == 1 and 14 < d.day < 22 # 1
# test
print(is_third_tuesday('Jun 23, 2015')) # False
print(is_third_tuesday('Jun 16, 2015')) # True
print(is_third_tuesday('Jul 21, 2015')) # True